package com.git.bds.mr.rp.mapper;

import com.git.bds.mr.rp.model.domain.UserRole;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 用户角色表 Mapper 接口
 * </p>
 *
 * @author 成大事
 * @since 2022-09-18 17:50:55
 */
@Mapper
public interface UserRoleMapper extends MPJBaseMapper<UserRole> {

    @Select("SELECT\n" +
            "\tr.role_name \n" +
            "FROM\n" +
            "\tlogin AS u\n" +
            "\tLEFT JOIN user_role ur ON ur.user_id = u.id\n" +
            "\tLEFT JOIN role r ON ur.user_id = r.id \n" +
            "WHERE\n" +
            "\tu.id = #{id};")
    List<String> getRoleList(@Param("id") Object id);
}
